package org.skywork.top.core.algorithm.str;

import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
import java.util.List;

/**
 * 回文数
 */
public class no_9 {

    public static boolean isPalindrome(int x) {
        String s = String.valueOf(x);
        List<String> list = new ArrayList<>(Arrays.stream(s.split("")).toList());
        List<String> oList = new ArrayList<>(list);
        Collections.reverse(list);
        boolean flag = true;
        for (int i = 0; i < list.size(); i++) {
            if (!list.get(i).equals(oList.get(i))) {
                flag = false;
                break;
            }
        }
        return flag;
    }



    public static void main(String[] args) {
        boolean flag = isPalindrome(-121);
        System.out.println(flag);
    }
}
